home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / pascal / xlibpas.zip / DEMO1.PAS < prev    next >
Pascal/Delphi Source File  |  1993-10-24  |  19KB  |  523 lines

  1. { VERY QUICK AND ULTRA-DIRTY DEMO USING XLIB
  2.     Simple Demo of MODE X Split screen and panning
  3.     Compile using Borland/Turbo Pascal 6.0/7.0 }
  4.  
  5.  
  6. Program Demo1;
  7.  
  8. Uses
  9.     Crt, XLib;
  10.  
  11. Const
  12.     MaxObjects = 10;
  13.     ObjectCount : integer = 0;
  14.     bm : array[0..193] of byte =
  15.         (4,12,
  16.         2,2,2,2,2,1,1,1,2,1,1,1,2,3,3,1,
  17.         2,0,0,3,2,0,0,3,2,0,0,3,2,0,0,3,
  18.         2,3,3,1,2,1,1,1,2,1,1,1,2,2,2,2,
  19.         2,2,2,2,1,1,1,1,1,1,1,1,1,3,3,1,
  20.         1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,
  21.         1,3,3,1,1,1,1,1,1,1,1,1,2,2,2,2,
  22.         2,2,2,2,1,1,1,1,1,1,1,1,1,3,3,1,
  23.         1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,
  24.         1,3,3,1,1,1,1,1,1,1,1,1,2,2,2,2,
  25.         2,2,2,2,1,1,1,2,1,1,1,2,1,3,3,2,
  26.         3,0,0,2,3,0,0,2,3,0,0,2,3,0,0,2,
  27.         1,3,3,2,1,1,1,2,1,1,1,2,2,2,2,2 );
  28.  
  29.     bm2 : array[0..193] of byte =
  30.         (4,12,
  31.         2,2,2,2,2,4,4,4,2,4,4,4,2,2,2,4,
  32.         2,0,0,2,2,0,0,2,2,0,0,2,2,0,0,2,
  33.         2,2,2,4,2,4,4,4,2,4,4,4,2,2,2,2,
  34.         2,2,2,2,4,4,4,4,4,4,4,4,4,2,2,4,
  35.         4,0,0,4,4,0,0,4,4,0,0,4,4,0,0,4,
  36.         4,2,2,4,4,4,4,4,4,4,4,4,2,2,2,2,
  37.         2,2,2,2,4,4,4,4,4,4,4,4,4,2,2,4,
  38.         4,0,0,4,4,0,0,4,4,0,0,4,4,0,0,4,
  39.         4,2,2,4,4,4,4,4,4,4,4,4,2,2,2,2,
  40.         2,2,2,2,4,4,4,2,4,4,4,2,4,2,2,2,
  41.         2,0,0,2,2,0,0,2,2,0,0,2,2,0,0,2,
  42.         4,2,2,2,4,4,4,2,4,4,4,2,2,2,2,2);
  43.  
  44.     palscrolldir : integer = 1;
  45.     textwindowx : integer = 0;
  46.     textwindowy : integer = 0;
  47. Type
  48.     AnimatedObject = record
  49.         X,Y,Width,Height,XDir,YDir,XOtherPage,YOtherPage : integer;
  50.         Image, bg, bgOtherPage : pointer;
  51.     end;
  52.  
  53. Var
  54.     objects : array[0..MaxObjects] of AnimatedObject;
  55.     userfnt1, pal, pal2 : pointer;
  56.  
  57. procedure initobject( x, y, width, height, xdir, ydir : integer;
  58.                                             var image : pointer );
  59. begin
  60.     objects[objectcount].X := x;
  61.     objects[objectcount].XOtherPage := x;
  62.     objects[objectcount].Y := y;
  63.     objects[objectcount].YOtherPage := y;
  64.     objects[objectcount].Width := width;
  65.     objects[objectcount].Height := height;
  66.     objects[objectcount].XDir := xdir;
  67.     objects[objectcount].YDir := ydir;
  68.     objects[objectcount].Image := image;
  69.     GetMem( objects[objectcount].bg, 4*width*height+20);
  70.     GetMem( objects[objectcount].bgOtherPage, 4*width*height+20);
  71.     xgetpbm(x,y,width,height,VisiblePageOffs,       objects[objectcount].bg^);
  72.     xgetpbm(x,y,width,height,HiddenPageOffs, objects[objectcount].bgOtherPage^);
  73.     inc(objectcount);
  74. end;
  75.  
  76. procedure MoveObject( var ObjectToMove : AnimatedObject );
  77. var
  78.     X, Y : integer;
  79.     cptr : pointer;
  80. begin
  81.     X := ObjectToMove.X + ObjectToMove.XDir;
  82.     Y := ObjectToMove.Y + ObjectToMove.YDir;
  83.     if (X < 0) or (X > (ScrnLogicalPixelWidth-(ObjectToMove.Width shl 2))) then
  84.     begin
  85.         ObjectToMove.XDir := -ObjectToMove.XDir;
  86.         X := ObjectToMove.X + ObjectToMove.XDir;
  87.      end;
  88.     if (Y < 0) or (Y > (ScrnLogicalHeight-ObjectToMove.Height)) then
  89.     begin
  90.         ObjectToMove.YDir := -ObjectToMove.YDir;
  91.         Y := ObjectToMove.Y + ObjectToMove.YDir;
  92.     end;
  93.     ObjectToMove.XOtherPage := ObjectToMove.X;
  94.     ObjectToMove.YOtherPage := ObjectToMove.Y;
  95.     ObjectToMove.X := X;
  96.     ObjectToMove.Y := Y;
  97.     cptr := ObjectToMove.bg;
  98.     ObjectToMove.bg := ObjectToMove.bgOtherPage;
  99.     ObjectToMove.bgOtherPage := cptr;
  100. end;
  101.  
  102. procedure animate;
  103. var
  104.     i : integer;
  105. begin
  106.     for i:=objectcount-1 downto 0 do
  107.         xputpbm(objects[i].XOtherPage,objects[i].YOtherPage,
  108.             HiddenPageOffs,objects[i].bgOtherPage^);
  109.     for i:=0 to objectcount-1 do
  110.     begin
  111.         MoveObject(objects[i]);
  112.         xgetpbm(objects[i].X,objects[i].Y,
  113.             objects[i].Width,objects[i].Height,HiddenPageOffs,
  114.             objects[i].bg^);
  115.         xputmaskedpbm(objects[i].X,objects[i].Y,HiddenPageOffs,
  116.             objects[i].Image^);
  117.  end;
  118. end;
  119.  
  120. procedure clearobjects;
  121. var
  122.     i : integer;
  123. begin
  124.     for i:=objectcount-1 downto 0 do
  125.         xputpbm(objects[i].XOtherPage,objects[i].YOtherPage,
  126.             HiddenPageOffs,objects[i].bgOtherPage^);
  127. end;
  128.  
  129.  
  130. procedure textwindow( Margin : integer );
  131. var
  132.     x0, y0, x1, y1 : integer;
  133. begin
  134.      x0 := Margin;
  135.      y0 := Margin;
  136.      x1 := ScrnPhysicalPixelWidth-Margin;
  137.      y1 := ScrnPhysicalHeight-Margin;
  138.      xrectfill(x0, y0, x1,y1,VisiblePageOffs,1);
  139.      xline(x0,y0,x1,y0,2,VisiblePageOffs);
  140.      xline(x0,y1,x1,y1,2,VisiblePageOffs);
  141.      xline(x0,y0,x0,y1,2,VisiblePageOffs);
  142.      xline(x1,y0,x1,y1,2,VisiblePageOffs);
  143.      xline(x0+2,y0+2,x1-2,y0+2,2,VisiblePageOffs);
  144.      xline(x0+2,y1-2,x1-2,y1-2,2,VisiblePageOffs);
  145.      xline(x0+2,y0+2,x0+2,y1-2,2,VisiblePageOffs);
  146.      xline(x1-2,y0+2,x1-2,y1-2,2,VisiblePageOffs);
  147.      textwindowx:=x0;
  148.      textwindowy:=y0;
  149. end;
  150.  
  151.  
  152. procedure waitforkeypress;
  153. begin
  154.     xshowmouse;
  155.     while keypressed do readkey;
  156.     palscrolldir := 1-palscrolldir;
  157.     while (not keypressed) and (MouseButtonStatus<>LeftPressed) do
  158.     begin
  159.         xrotpalstruc(pal^,palscrolldir);
  160.         mousefrozen := 1;
  161.         xputpalstruc(pal^);
  162.         xupdatemouse;
  163.     end;
  164.     while keypressed do readkey;
  165. end;
  166.  
  167.  
  168. procedure quit;
  169. begin
  170.     xmouseremove;
  171.     textmode(co80+font8x8);
  172.     writeln('Thanks to everyone who assisted in the development of XLIB.');
  173.     writeln('Special thanks to Matthew Mackenzie for contributing');
  174.     writeln('lots of code, documentation and ideas.');
  175.     writeln('If you make any money using this code and you''re the generous');
  176.     writeln('type please send us some, or at least a copy of your program');
  177. end;
  178.  
  179. procedure terminate;
  180. begin
  181.     halt(0);
  182. end;
  183.  
  184. procedure intro1;
  185. begin
  186.     xsetrgb(1,40,40,40);
  187.     xsetrgb(2,63,63,0);
  188.     xsetrgb(3,63,0,0);
  189.     xsetrgb(4,0,63,0);
  190.     xsetrgb(5,0,0,63);
  191.     xsetrgb(6,0,0,28);
  192.     xsetrgb(7,0,28,0);
  193.     xsetrgb(8,28,0,0);
  194.     xsetrgb(9,0,0,38);
  195.     textwindow(20);
  196.     xsetfont(1);
  197.     xprintf(textwindowx+54,textwindowy+4,VisiblePageOffs,6,'     XLIB Version 6.0');
  198.     xprintf(textwindowx+53,textwindowy+3,VisiblePageOffs,2,'     XLIB Version 6.0');
  199.     xsetfont(0);
  200.     xprintf(textwindowx+24,textwindowy+18,VisiblePageOffs,6,'       Not the Unix version');
  201.     xprintf(textwindowx+23,textwindowy+17,VisiblePageOffs,2,'       Not the Unix version');
  202.  
  203.     xprintf(textwindowx+24,168,VisiblePageOffs,6,'     Press any key to continue');
  204.     xprintf(textwindowx+23,167,VisiblePageOffs,2,'     Press any key to continue');
  205. end;
  206.  
  207. procedure subsequentpage;
  208. begin
  209.     xhidemouse;
  210.     textwindow(20);
  211.     xsetfont(1);
  212.     xprintf(textwindowx+54,textwindowy+4,VisiblePageOffs,6,'     XLIB Version 6.0');
  213.     xprintf(textwindowx+53,textwindowy+3,VisiblePageOffs,2,'     XLIB Version 6.0');
  214.     xsetfont(0);
  215.     xprintf(textwindowx+24,168,VisiblePageOffs,6,'     Press any key to continue');
  216.     xprintf(textwindowx+23,167,VisiblePageOffs,2,'     Press any key to continue');
  217. end;
  218.  
  219. procedure loaduserfonts;
  220. var
  221.     f : File;
  222. begin
  223.     assign(f,'d:\bp\xlib\var6x8.fnt');
  224.     reset(f,1);
  225.     blockread( f, userfnt1^, filesize(f) );
  226.     close(f);
  227.     xregisteruserfont(userfnt1^);
  228. end;
  229.  
  230.  
  231.  
  232. procedure main;
  233. var
  234.     i, j, xinc, yinc, Margin : integer;
  235.     ch : char;
  236.     a : byte;
  237.     currx, curry : word;
  238.     x0,x1,x2,y0,y1,y2 : integer;
  239.     pt : pointer;
  240. begin
  241.     GetMem(pal,256*3);
  242.     GetMem(pal2,256*3);
  243.     GetMem(userfnt1,256*16+4);
  244.     currx := 0;
  245.     curry := 0;
  246.  
  247.     xtextmode;
  248.     xsetmode(XMODE360x200,500);
  249.     xsetsplitscreen(ScrnPhysicalHeight-60);
  250.     xsetdoublebuffer(220);
  251.     xhidesplitscreen;
  252.     xtextinit;
  253.     xmouseinit;
  254.     mousecolor := 2;
  255.     for j:=0 to ScrnPhysicalHeight-1 do
  256.         xline(0,j,ScrnLogicalPixelWidth,j,16+(j mod 239),VisiblePageOffs);
  257.  
  258.     xgetpalstruc(pal^,240,16);
  259.     loaduserfonts;
  260.     intro1;
  261.     xsetfont(2);
  262.     xhidemouse;
  263.     xprintf(textwindowx+5,50   ,VisiblePageOffs,9, '   Hi, folks. This is yet another FREEWARE Mode X');
  264.     xprintf(textwindowx+5,50+8 ,VisiblePageOffs,9, ' graphics library. It is by no means complete,');
  265.     xprintf(textwindowx+5,50+16,VisiblePageOffs,9, ' but I believe it contains a rich enough set of');
  266.     xprintf(textwindowx+5,50+24,VisiblePageOffs,9, ' functions to achieve its design goal - to be');
  267.     xprintf(textwindowx+5,50+32,VisiblePageOffs,9, ' a game development oriented library for');
  268.     xprintf(textwindowx+5,50+40,VisiblePageOffs,9, ' Borland TP/BP programmers.');
  269.  
  270.     xprintf(textwindowx+5,50+48,VisiblePageOffs,9, '   This library comes with BP/TP sources.');
  271.     xprintf(textwindowx+5,50+56,VisiblePageOffs,9, ' It was inspired by the DDJ Graphics column and');
  272.     xprintf(textwindowx+5,50+64,VisiblePageOffs,9, ' many INTERNET and USENET authors who, unlike the');
  273.     xprintf(textwindowx+5,50+72,VisiblePageOffs,9, ' majority of programmers (you know who you are!),');
  274.     xprintf(textwindowx+5,50+80,VisiblePageOffs,9, ' willingly share their code and ideas with others.');
  275.  
  276.     xprintf(textwindowx+5,50+88,VisiblePageOffs,9, '   I can''t afford, nor do I want, to copyright');
  277.     xprintf(textwindowx+5,50+96,VisiblePageOffs,9, ' this code - but if you use it, some credit would ');
  278.     xprintf(textwindowx+5,50+104,VisiblePageOffs,9,' be appreciated. ');
  279.  
  280.     waitforkeypress;
  281.  
  282.     subsequentpage;
  283.     xsetfont(0);
  284.     xprintf(textwindowx+24,textwindowy+18,VisiblePageOffs,6,'Supported 256 colour resolutions.');
  285.     xprintf(textwindowx+23,textwindowy+17,VisiblePageOffs,3,'Supported 256 colour resolutions.');
  286.     xsetfont(2);
  287.     xprintf(textwindowx+5,50   ,VisiblePageOffs,9, ' 320x200   Standard for games       ~ 4 pages');
  288.     xprintf(textwindowx+5,50+8 ,VisiblePageOffs,9, ' 320x240   DDJ Mode X square pixels ~ 3.5 pages');
  289.     xprintf(textwindowx+5,50+16,VisiblePageOffs,9, ' 360x200   My favourite for games   ~ 3 pages  ');
  290.     xprintf(textwindowx+5,50+24,VisiblePageOffs,9, ' 360x240                            ~ 2.8 pages');
  291.     xprintf(textwindowx+5,50+32,VisiblePageOffs,9, ' 320x400                            ~ 2 pages  ');
  292.     xprintf(textwindowx+5,50+40,VisiblePageOffs,9, ' 320x480   All subsequent modes support');
  293.     xprintf(textwindowx+5,50+48,VisiblePageOffs,9, ' 360x400     less than two pages.');
  294.     xprintf(textwindowx+5,50+56,VisiblePageOffs,9, ' 360x480');
  295.     xprintf(textwindowx+5,50+64,VisiblePageOffs,9, ' 376x282,360x360,376x308,376x564,256x200,256x240');
  296.     xprintf(textwindowx+5,50+72,VisiblePageOffs,9, ' Phew! and they''ll run on all VGA cards and ');
  297.     xprintf(textwindowx+5,50+80,VisiblePageOffs,9, ' monitors (some of the weird ones are best suited');
  298.     xprintf(textwindowx+5,50+88,VisiblePageOffs,9, ' to monitors with both vert & horiz adjustments)');
  299.     xprintf(textwindowx+5,50+98,VisiblePageOffs,2, '  ');
  300.     xprintf(textwindowx+5,50+106,VisiblePageOffs,2,' Overkill? Maybe!! ');
  301.  
  302.  
  303.     waitforkeypress;
  304.  
  305.     subsequentpage;
  306.     xprintf(textwindowx+24,textwindowy+18,VisiblePageOffs,6,'      Text display functions.');
  307.     xprintf(textwindowx+23,textwindowy+17,VisiblePageOffs,3,'      Text display functions.');
  308.     xsetfont(2);
  309.     xprintf(textwindowx+5,50   ,VisiblePageOffs,9, '   Several text printing functions are provided.');
  310.     xprintf(textwindowx+5,50+8 ,VisiblePageOffs,9, ' They support the VGA ROM 8x14 and 8x8 fonts as');
  311.     xprintf(textwindowx+5,50+16,VisiblePageOffs,9, ' well as user-defined fonts (like this 6x8 font).');
  312.     xprintf(textwindowx+5,50+24,VisiblePageOffs,9, ' Furthermore, a function similar to printf is');
  313.     xprintf(textwindowx+5,50+32,VisiblePageOffs,9, ' included which provides formatted text output.');
  314.     xprintf(textwindowx+5,50+40,VisiblePageOffs,9, ' User defined fonts may be proportionally spaced');
  315.     xprintf(textwindowx+5,50+58,VisiblePageOffs,9, ' but have a maximum width of 8 pixels.');
  316.  
  317.  
  318.     waitforkeypress;
  319.  
  320.     subsequentpage;
  321.     xprintf(textwindowx+24,textwindowy+18,VisiblePageOffs,6,'    Advanced screen functions.');
  322.     xprintf(textwindowx+23,textwindowy+17,VisiblePageOffs,3,'    Advanced screen functions.');
  323.     xsetfont(2);
  324.     xprintf(textwindowx+5,50   ,VisiblePageOffs,9, '   The library supports virtual screens larger');
  325.     xprintf(textwindowx+5,50+8 ,VisiblePageOffs,9, ' than the physical screen, panning of such');
  326.     xprintf(textwindowx+5,50+16,VisiblePageOffs,9, ' screens, and a split screen option.');
  327.     xprintf(textwindowx+5,50+24,VisiblePageOffs,9, '   These functions can be used together or');
  328.     xprintf(textwindowx+5,50+32,VisiblePageOffs,9, ' in isolation, and in the lower resolutions');
  329.     xprintf(textwindowx+5,50+40,VisiblePageOffs,9, ' double buffering can also be accomplished.');
  330.  
  331.     xrectfill(0, 0, ScrnPhysicalPixelWidth,60,SplitScrnOffs,5);
  332.     xline(0,0,ScrnPhysicalPixelWidth,0,2,SplitScrnOffs);
  333.     xsetfont(1);
  334.     xprintf(10,10,SplitScrnOffs,2, ' This is a split screen, tops for scores.');
  335.     xsetfont(0);
  336.     for i:=ScrnPhysicalHeight downto ScrnPhysicalHeight-60 do
  337.         xadjustsplitscreen(i);
  338.     xprintf(10,25,SplitScrnOffs,2, ' Even better for scrolling games etc.');
  339.  
  340.     xcpvidrect(0,0,ScrnLogicalPixelWidth,ScrnLogicalHeight,0,0,
  341.         VisiblePageOffs,HiddenPageOffs,
  342.         ScrnLogicalPixelWidth,ScrnLogicalPixelWidth);
  343.  
  344.  
  345.     xshowmouse;
  346.     waitforkeypress;
  347.     pt := @bm2;
  348.     initobject(60,90,4, 12, -1, 1, pt );
  349.     pt := @bm;
  350.     initobject(30,30,4, 12, 1, 1, pt );
  351.     initobject(80,120,4, 12, 2, 1, pt );
  352.     initobject(300,200,4, 12, 1, -2, pt );
  353.     initobject(360,30,4, 12, -1, -1, pt );
  354.     initobject(360,10,4, 12, -2, 2, pt );
  355.  
  356.     xhidemouse;
  357.  
  358.     while not keypressed do
  359.     begin
  360.         animate;
  361.         if (objects[0].X>=currx+ScrnPhysicalPixelWidth-32) and
  362.             (currx < MaxScrollX) then inc(currx)
  363.         else if (objects[0].X < currx+16) and ( currx > 0) then dec(currx);
  364.         if (objects[0].Y>=curry+ScrnPhysicalHeight-92) and
  365.             (       curry < MaxScrollY) then inc(curry)
  366.         else if (objects[0].Y < curry+16) and ( curry > 0) then dec(curry);
  367.         xpageflip(currx, curry);
  368.     end;
  369.     while keypressed do readkey;
  370.  
  371.     clearobjects;
  372.     xpageflip(currx,curry);
  373.  
  374.  
  375.     xsetstartaddr(0,0);
  376.  
  377.  
  378.     for j:=0 to 3 do
  379.     begin
  380.         xhidesplitscreen;
  381.         delay(100);
  382.         xshowsplitscreen;
  383.         delay(100);
  384.     end;
  385.  
  386.  
  387.     for i:= ScrnPhysicalHeight-60 to ScrnPhysicalHeight do
  388.         xadjustsplitscreen(i);
  389.  
  390.     xhidemouse;
  391.     subsequentpage;
  392.     xprintf(textwindowx+24,textwindowy+18,VisiblePageOffs,6,'        Palette functions.');
  393.     xprintf(textwindowx+23,textwindowy+17,VisiblePageOffs,3,'        Palette functions.');
  394.     xsetfont(2);
  395.     xprintf(textwindowx+5,50   ,VisiblePageOffs,9, '   A number of palette manipulation functions');
  396.     xprintf(textwindowx+5,50+8 ,VisiblePageOffs,9, ' are provided. You have already seen some of');
  397.     xprintf(textwindowx+5,50+16,VisiblePageOffs,9, ' them in action. Another common operation is');
  398.     xprintf(textwindowx+5,50+24,VisiblePageOffs,9, ' palette fading.                     ');
  399.  
  400.     i:=0;
  401.     a:=255;
  402.     while (xcpcontrastpalstruc(pal^, pal2^,a))>0 do
  403.     begin
  404.         a := a-2;
  405.         xputpalstruc(pal2^);
  406.         xrotpalstruc(pal^,palscrolldir);
  407.         inc(i);
  408.     end;
  409.     for j:=0 to i-1 do
  410.     begin
  411.         xcpcontrastpalstruc(pal^, pal2^,a);
  412.         a := a+2;
  413.         xputpalstruc(pal2^);
  414.         xrotpalstruc(pal^,palscrolldir);
  415.     end;
  416.     waitforkeypress;
  417.     subsequentpage;
  418.     xprintf(textwindowx+24,textwindowy+18,VisiblePageOffs,6,'    NEW Version 3.0 Functions!');
  419.     xprintf(textwindowx+23,textwindowy+17,VisiblePageOffs,3,'    NEW Version 3.0 Functions!');
  420.     xsetfont(2);
  421.     xprintf(textwindowx+5,50   ,VisiblePageOffs,9, ' NEW functions not demonstrated here include:');
  422.     xprintf(textwindowx+5,50+10,VisiblePageOffs,9, '  - RLE data compression');
  423.     xprintf(textwindowx+5,50+20,VisiblePageOffs,9, '  - FAST compiled masked bitmaps');
  424.     xprintf(textwindowx+5,50+30,VisiblePageOffs,9, '  - Hardware detection');
  425.  
  426.     xshowmouse;
  427.     waitforkeypress;
  428.  
  429.     xhidemouse;
  430.     for i := 0 to 149 do
  431.     begin
  432.         xcircle(0, 0, i, 181 - i, VisiblePageOffs);
  433.         xcircle(360 - i, 0, i, i + 30, VisiblePageOffs);
  434.         xcircle(0, 200 - i, i, i + 30, VisiblePageOffs);
  435.         xcircle(360 - i, 200 - i, i, 181 - i, VisiblePageOffs);
  436.     end;
  437.     for i := 0 to 99 do
  438.         xfilledcircle(80 + i, i, 201 - (i shl 1), 30+i, VisiblePageOffs);
  439.     xshowmouse;
  440.     waitforkeypress;
  441.  
  442.     subsequentpage;
  443.     xprintf(textwindowx+24,textwindowy+18,VisiblePageOffs,6,'    NEW Version 4.0 Functions!');
  444.     xprintf(textwindowx+23,textwindowy+17,VisiblePageOffs,3,'    NEW Version 4.0 Functions!');
  445.     xsetfont(2);
  446.     xprintf(textwindowx+5,50   ,VisiblePageOffs,9, ' NEW functions not demonstrated here include:');
  447.     xprintf(textwindowx+5,50+10,VisiblePageOffs,9, '  - FAST VRAM-based masked bitmaps, including');
  448.     xprintf(textwindowx+5,50+18,VisiblePageOffs,9, '      support for clipping regions');
  449.     xprintf(textwindowx+5,50+28,VisiblePageOffs,9, '  - Faster, smaller compiled bitmaps');
  450.     xprintf(textwindowx+5,50+38,VisiblePageOffs,9, '  - Improved planar bitmap performance and');
  451.     xprintf(textwindowx+5,50+46,VisiblePageOffs,9, '      additional support for clipping');
  452.     xprintf(textwindowx+5,50+56,VisiblePageOffs,9, '  - mouse module');
  453.     xprintf(textwindowx+5,50+66,VisiblePageOffs,9, '  - Detection of math co-processor and mouse');
  454.     xprintf(textwindowx+5,50+76,VisiblePageOffs,9, '  - Bezier curve module');
  455.     xprintf(textwindowx+5,50+86,VisiblePageOffs,9, '  - Four new resolutions, including one with');
  456.     xprintf(textwindowx+5,50+94,VisiblePageOffs,9, '      square pixels (376x282)');
  457.     xprintf(textwindowx+5,50+104,VisiblePageOffs,9, '  - More bug fixes');
  458.  
  459.     waitforkeypress;
  460.  
  461.  
  462.     subsequentpage;
  463.     xprintf(textwindowx+24,textwindowy+18,VisiblePageOffs,6,'    NEW Version 5.0 Functions!');
  464.     xprintf(textwindowx+23,textwindowy+17,VisiblePageOffs,3,'    NEW Version 5.0 Functions!');
  465.     xsetfont(2);
  466.     xprintf(textwindowx+5,50   ,VisiblePageOffs,9, ' - *FAST* filled and clipped triangles ideal for');
  467.     xprintf(textwindowx+5,50+10,VisiblePageOffs,9, '   3D work. Thanks to S. Dollins for the code.');
  468.     xprintf(textwindowx+5,50+20,VisiblePageOffs,9, ' - Filled and clipped polygons');
  469.     xprintf(textwindowx+5,50+30,VisiblePageOffs,9, ' - and of course bug fixes!');
  470.  
  471.     xshowmouse;
  472.     waitforkeypress;
  473.  
  474.     randomize;
  475.     xhidemouse;
  476.     while keypressed do readkey;
  477.     palscrolldir:=1-palscrolldir;
  478.     repeat
  479.  
  480.         i:=random(256);
  481.         x0:=random(ScrnLogicalPixelWidth);
  482.         x1:=random(ScrnLogicalPixelWidth);
  483.         x2:=random(ScrnLogicalPixelWidth);
  484.         y0:=random(ScrnPhysicalHeight);
  485.         y1:=random(ScrnPhysicalHeight);
  486.         y2:=random(ScrnPhysicalHeight);
  487.         xtriangle(x0,y0,x1,y1,x2,y2,i,VisiblePageOffs);
  488.     until keypressed;
  489.     while keypressed do readkey;
  490.  
  491.     subsequentpage;
  492.     xprintf(textwindowx+24,textwindowy+18,VisiblePageOffs,6,'             PLEASE...');
  493.     xprintf(textwindowx+23,textwindowy+17,VisiblePageOffs,3,'             PLEASE...');
  494.     xsetfont(2);
  495.     xprintf(textwindowx+5,50   ,VisiblePageOffs,9, '   Please mention my name in programs that use XLIB');
  496.     xprintf(textwindowx+5,50+8 ,VisiblePageOffs,9, ' just to make me feel it was worth the effort.');
  497.     xprintf(textwindowx+5,50+16,VisiblePageOffs,9, ' If you have any bug to report please feel free to');
  498.     xprintf(textwindowx+5,50+24,VisiblePageOffs,9, ' mail me a message. Any hints, suggestions and');
  499.     xprintf(textwindowx+5,50+32,VisiblePageOffs,9, ' contributions are welcome and encouraged.');
  500.     xprintf(textwindowx+5,50+52,VisiblePageOffs,9, ' I have contributed this code to the public domain.');
  501.     xprintf(textwindowx+5,50+60,VisiblePageOffs,9, '    Please respect my wishes and leave it there.');
  502.  
  503.     xprintf(textwindowx+5,50+80,VisiblePageOffs,9, '   Finally, I hope you all find this stuff useful,');
  504.     xprintf(textwindowx+5,50+96,VisiblePageOffs,9, ' Themie Gouthas - egg@dstos3.dsto.gov.au');
  505.     xprintf(textwindowx+5,50+106,VisiblePageOffs,9, ' Tristan Tarrant - tristant@cogs.susx.ac.uk');
  506.  
  507.     waitforkeypress;
  508.  
  509.     xhidemouse;
  510.  
  511.     xshiftrect (27, 27, 360-27, 177, 27, 23, VisiblePageOffs);
  512.     xrectfill(25, 173, 335, 176, VisiblePageOffs, 1);
  513.     for i := 0 to 49 do
  514.         xshiftrect (27, 26, 360-27, 177 - (i * 3), 27, 23, VisiblePageOffs);
  515.     quit;
  516. end;
  517.  
  518. begin
  519.     main;
  520. end.
  521.  
  522.  
  523.